

<!-- 收货凭证上传 -->
<template>
	<view class="descImage-Container">
		<textarea v-model="content" @input="contentChange()" :placeholder="placeholderText" placeholder-class="placeholderStyle"/>
	
		<view class="img-list">
			<view class="proof-img" v-for="(item, index) in upLoadLists" :key="index">
				<image class="img-item" :src="imgSite + '/' +item" mode="aspectFill" :data-index="index"></image>
				<image @click="deleteImage(index)" class="deleteBtn" :src="icon.deleteBtn" mode=""></image>
			</view>
			<view class="upload-img">
				<view @click="chooseImage()" v-if="upLoadLists.length<=8" class="column-div">
					<image class="uploadBtn" :src="icon.uploadBtn" mode="widthFix"></image>
					<view class="uploadText">
						上传照片
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState, mapMutations } from 'vuex';
	
	export default {
		data() {
			return {
				icon: {
					uploadBtn: "/static/images/component/uploadProof/uploadBtn.png",
					deleteBtn: "/static/images/component/uploadProof/deleteBtn.png"
				},
				
				content: "",
			};
		},
	
		computed: {
			...mapState(['imgSite'])
		},
		props: {
			placeholderText: {
				type: String
			},
			upLoadLists: Array
		},
		methods: {
			
			//输入内容
			contentChange() {
				console.log(this.content);
				this.$emit('contentChange', this.content);
			},
			
			//上传图片
			chooseImage() {
				this.$emit('chooseImage');
			},
			
			//删除图片
			deleteImage(index) {
				this.$emit('deleteImage', index);
			}
		}
	}
</script>

<style lang="less">
	
	.descImage-Container {
		background: rgba(247, 247, 247, 1);
		border-radius: 10rpx;
	
		textarea {
			box-sizing: border-box;
			padding: 40rpx 30rpx;
			width: 100%;
			height: 200rpx;
			font-size: 26rpx;
			font-family: PingFang SC;
			line-height: 34rpx;
		}
		
		.placeholderStyle {
			font-size:26rpx;
			font-family:PingFang SC;
			color:rgba(191,191,191,1);
		}
		
		.img-list {
			display: flex;
			flex-wrap: wrap;
			padding-left: 30rpx;
			padding-bottom: 58rpx;
			
			.proof-img {
				position: relative;
				width: 160rpx;
				height: 160rpx;
				
				.img-item {
					position: absolute;
					left: 0;
					bottom: 0;
					width:146rpx;
					height:146rpx;
					border-radius:8rpx;
				}
				
				.deleteBtn {
					position: absolute;
					top: 0;
					right: 8rpx;
					width: 34rpx;
					height: 34rpx;
				}
			}
			
			.upload-img {
				display: flex;
				flex-direction: column;
				align-items: flex-end;
				justify-content: flex-end;
				width: 160rpx;
				height: 160rpx;
				
				& > view {
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					left: 0;
					bottom: 0;
					width:146rpx;
					height:146rpx;
					border-radius:8rpx;
					border: 2rpx dashed rgba(219,219,219,1);
				}
				.uploadBtn {
					width: 54rpx;
					height: 45rpx;
					margin-bottom: 11upx;
				}
				
				.uploadText {
					font-size:22rpx;
					font-family:PingFang SC;
					// font-weight:500;
					color:rgba(153,153,153,1);
					line-height:34rpx;
				}
			}
		}
	}
</style>



